<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增贷款记录')" />
	<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tLoansLog-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">借款人：</label>
				<div class="col-sm-8">
					<input id="loanBorrower" name="loanBorrower" class="form-control" type="text" >
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">借款金额：</label>
				<div class="col-sm-8">
					<input id="loanAmounts" name="loanAmounts" type="text" class="form-control">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">借款渠道：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="loanPlace" class="form-control m-b" th:with="type=${@dict.getType('loans_place')}">
							<option value="">请选择</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">借多久：</label>
				<div class="col-sm-8">
					<input id="loanHowLong" name="loanHowLong" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">借款利率：</label>
				<div class="col-sm-8">
					<input id="loanRate" name="loanRate" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">借款时间：</label>
				<div class="col-sm-8">
						<div class="input-group date">
							<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
							<input type="text" class="form-control" id="loanTime" name="loanTime">
						</div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">还款方式：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="paymentMethod" class="form-control m-b" th:with="type=${@dict.getType('payment_methods')}">
							<option value="">请选择</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">还款日：</label>
				<div class="col-sm-8">
					<input id="paymentDay" name="paymentDay" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">借款用途：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="loanUse" class="form-control m-b" th:with="type=${@dict.getType('loans_use')}">
							<option value="">请选择</option>
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
	<th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
		var prefix = ctx + "loans/loansLog"
		$("#form-tLoansLog-add").validate({
			rules:{
				loanAmounts:{
					required:true,
				},
				loanHowLong:{
					required:true,
				},
				paymentMethod:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-tLoansLog-add').serialize());
	        }
	    }

		$(".input-group.date").datetimepicker({
			format: "yyyy-mm-dd",
			minView: "month",
			autoclose: true,
			initialDate: new Date()
		});
	</script>
</body>
</html>
